<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
     <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
    <%@page isELIgnored="false" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="utf-8">
	<title>新增企业</title>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link id="bootstrap-style" href="<c:url value="/css/bootstrap.min.css"/>" rel="stylesheet">
	<link href="<c:url value="/css/bootstrap-responsive.min.css"/>" rel="stylesheet">
	<link id="base-style" href="<c:url value="/css/style.css"/>" rel="stylesheet">
	<link id="base-style-responsive" href="<c:url value="/css/style-responsive.css"/>" rel="stylesheet">
	<link href="<c:url value="/css/index.css"/>" rel="stylesheet">
	<link rel="shortcut icon" href="<c:url value="/img/favicon.ico"/>">
	<link href="<c:url value="/css/page.css"/>" rel="stylesheet">
	<%-- <link rel="stylesheet" type="text/css" href="<c:url value="/css/jquery.datetimepicker.css"/>"/> --%>
	<link href="<c:url value="/css/navuser.css"/>" rel="stylesheet">
	<link href="<c:url value="/css/but.css"/>" rel="stylesheet">
	<script src="<c:url value="/js/jquery-1.9.1.min.js"/>"></script>
	<script src="<c:url value="/js/jquery-migrate-1.0.0.min.js"/>"></script>
	<script type="text/javascript" src="<c:url value="/js/layer/layer.js"/>"></script>
	<script src="<c:url value="/js/laydate/laydate.js"/>"></script>
	<%-- <script src="<c:url value="/js/build/jquery.datetimepicker.full.js"/>"></script> --%>
	<script src="<c:url value="/js/orgin.js"/>"></script>
	<script src="<c:url value="/js/filebut.js"/>"></script>
</head>
	<script type="text/javascript">
		 function closebutton1() {
				var index = parent.layer.getFrameIndex(window.name);  
			 	parent.layer.close(index);  
			 }
		 function save1(){
		     var formData = new FormData($("#customerform")[0]);
		     alert(formData);
		     $.ajax({  
		          url: '<%=basePath%>organization/save',
		          type: 'POST',  
		          data: formData,  
		          async: false,  
		          cache: false,
		          contentType: false,  
		          processData: false,  
		          success: function (result) {
		                if("addok"==result){
		                    alert("添加企业成功");
		                    closebutton1();
		                    window.parent.location.reload(); //刷新父页面
		                }else if("addno"==result){
		                    alert("添加企业失败");
		                }else if("updateok"==result){
		                	alert("修改企业成功");
		                    closebutton1();
		                    window.parent.location.reload(); //刷新父页面
		                }else if("updateno"==result){
		                	alert("修改企业失败");
		                }else if("custNameExist"==result){
		                	alert("企业已经存在");
		                }
		          }
		     });
		 }
	</script>
<body>
	<div id="content" class="span10" style="width: 100%;background-color:#F9F9F9;">
				
				<div style="background-color:#FFF;height: 1200px">
				
				<form name="customerform" id="customerform" method="post">
					<input type="hidden" name="id" value="${id}">
					<div class="row-fluid content-table">
						<table class="table table-striped table-bordered bootstrap-datatable">
							<tbody>
								<tr>
									<td>企业名称</td>
									<td><input style="margin-left: -152px;" type="text" id="custName" name="name" value="${organization.name}"></td>
								</tr>
								<tr>
									<td>企业编码</td>
									<td><input style="margin-left: -152px;" type="text" id="custZip" name="code" value="${organization.code}"></td>
								</tr>
								<tr>
									<td>状态</td>
									<td>
										<c:if test="${organization.status == 1 || organization.status == null}">
											<input style="margin-left: -152px;" name="status" type="radio" checked="checked" value="1">启用
					                  	  	<input name="status" type="radio" value="0">关闭
										</c:if>
										<c:if test="${organization.status == 0}">
					                  	  	<input style="margin-left: -152px;" name="status" type="radio" value="1">启用
					                  	  	<input name="status" type="radio" value="0" checked="checked">关闭
					                  	</c:if>
									</td>
								</tr>
							</tbody>
						</table>
					</div>
				</form>
			<div class="row-fluid content-table">
					<table class="table  bootstrap-datatable" style=" border:none; border-spacing:0; border-collapse:collapse;margin:0;padding:0;">
					  <tbody>
						<tr class="content-search" style="text-align: center;">
							<td colspan="6">
								<div>
									<button style="background-color: #dadada;color: #666;" type="button" onclick="closebutton1();" id="output1">取消</button>
									<button class="but" onclick="save1();">保存</button>
								</div>
							</td>
						</tr>
					  </tbody>
				  </table>            
				</div>
			</div>
		</div>	
</body>
</html>